package com.huluobo.h3kotlinproject.net

import com.huluobo.h3kotlinproject.cart.CartBeanResult
import com.huluobo.h3kotlinproject.category.CategoryBeanResult
import com.huluobo.h3kotlinproject.data.GoodsListResult
import com.huluobo.h3kotlinproject.data.UserBeanResult
import com.huluobo.h3kotlinproject.detail.ChangeCartBeanResult
import com.huluobo.h3kotlinproject.detail.GoodsDetailBeanResult
import com.huluobo.h3kotlinproject.home.HomeBannerBeanResult
import com.huluobo.h3kotlinproject.home.NavGoodsBeanResult
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

/**
 *  Created by LC on 2023/10/16.
 */
interface ApiService {
    @POST(Const.URL_LOGIN)
    fun login(@Body body: RequestBody): Observable<UserBeanResult>

    @POST(Const.URL_REGISTER)
    fun register(@Body body: RequestBody): Observable<UserBeanResult>

    @GET(Const.URL_HOME_GET_GOODS_LIST)
    fun getHomeGoodsList(
        @Query(Const.PARAM_CATEGORY_ID) categoryId: Int,
        @Query(Const.PARAM_CURRENT_PAGE) currentPage: Int,
        @Query(Const.PARAM_PAGE_SIZE) pageSize: Int
    ): Observable<GoodsListResult>

    @GET(Const.URL_BANNER)
    fun getBanners(): Observable<HomeBannerBeanResult>

    @GET(Const.URL_NAV)
    fun getNav(): Observable<NavGoodsBeanResult>

    @GET(Const.URL_GOODS_DETAIL)
    fun getGoodsDetail(@Query(Const.PARAM_GOODS_ID) id: Int): Observable<GoodsDetailBeanResult>

    @POST(Const.URL_ADD_TO_CART)
    fun addToCart(@Body body: RequestBody): Observable<ChangeCartBeanResult>

    @GET(Const.URL_GET_CART)
    fun getCartList(): Observable<CartBeanResult>

    @POST(Const.URL_DELETE_CART)
    fun deleteCart(@Body body: RequestBody): Observable<ChangeCartBeanResult>

    @GET(Const.URL_CATEGORY_PARENT_CHILD)
    fun getCategoryParentChild(): Observable<CategoryBeanResult>
}